import { createRouter, createWebHistory } from 'vue-router'
import Login from '../views/Login.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      redirect: 'login'
    },
    {
      path: '/login',
      name: 'login',
      component: Login
    },
    {
      path: '/home',
      name: 'home',
      component: () => import('../views/HomeView.vue'),
      children: [
        {
          path: '/user/list',
          name: 'Userlist',
          component: () => import('../views/user/list.vue')
        }, {
          path: '/user/add',
          name: 'Useradd',
          component: () => import('../views/user/add.vue')
        }, {
          path: '/user/del',
          name: 'Userdel',
          component: () => import('../views/user/del.vue')
        }, {
          path: '/user/edit',
          name: 'Useredit',
          component: () => import('../views/user/edit.vue')
        },

         {
          path: '/shop/list',
          name: 'Shoplist',
          component: () => import('../views/shop/list.vue')
        }, {
          path: '/shop/add',
          name: 'Shopadd',
          component: () => import('../views/shop/add.vue')
        }, {
          path: '/shop/del',
          name: 'Shopdel',
          component: () => import('../views/shop/del.vue')
        }, {
          path: '/shop/edit',
          name: 'Shopedit',
          component: () => import('../views/shop/edit.vue')
        },

         {
          path: '/role/list',
          name: 'Rolelist',
          component: () => import('../views/role/list.vue')
        }, {
          path: '/role/add',
          name: 'Roleadd',
          component: () => import('../views/role/add.vue')
        }, {
          path: '/role/del',
          name: 'Roledel',
          component: () => import('../views/role/del.vue')
        }, {
          path: '/role/edit',
          name: 'Roleedit',
          component: () => import('../views/role/edit.vue')
        },
      ]
    }
  ]
})

export default router
